/* ==========================================================================
   Listview

   Default Mendix Listview Widget. The list view shows a list of objects arranged vertically. Each object is shown using a template
========================================================================== */

.mx-listview {
    // Remove widget padding
    padding: 0;

    /* Clear search button (overrides load more button stying) */
    .mx-button.mx-listview-clear-button {
        width: auto;
    }

    // Search bar
    .mx-listview-searchbar {
        margin-bottom: $gutter-size;
    }

    /* Load more button */
    & > .mx-button {
        width: 100%;
        margin: 10px auto;
    }
    .mx-listview-list {
        margin: 0;
        .mx-listview-empty {
            border-style: none;
            background-color: transparent;
        }
    }
    .mx-listview-item {
        @include transition();
        padding: $listview-padding-top $listview-padding-right $listview-padding-bottom $listview-padding-left;
        border-width: 1px 0 0 0;
        border-style: solid;
        border-color: $grid-border-color;
        background-color: $grid-bg;

        &:first-child {
            border-radius: 0; // Reset mxui listview style
        }
        &:last-child {
            border-bottom: 1px solid $grid-border-color;
            border-radius: 0; // Reset mxui listview style
        }
        &:nth-child(2n + 1) {
            background-color: $grid-bg;
        }
        &:hover {
            background-color: $grid-bg;
        }
        &:focus,
        &:active {
            background-color: $grid-bg-hover;
        }
        &.selected {
            background-color: $grid-bg-selected !important;
        }
    }
    .mx-layoutgrid {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
}

//== Design Properties
//## Helper classes to change the look and feel of the component
//-------------------------------------------------------------------------------------------------------------------//
// Bordered
.listview-bordered.mx-listview {
    .mx-listview-item {
        border: 1px solid $grid-border-color;
        border-top: 0;
        &:first-child {
            border-top: 1px solid $grid-border-color;
            border-radius: 0;
        }
        &:last-child {
            border-radius: 0;
        }
    }
}

// Striped
.listview-striped.mx-listview {
    .mx-listview-item:nth-child(2n + 1) {
        background-color: $grid-bg-striped;
    }
}

// Items as seperated blocks
.listview-seperated.mx-listview {
    .mx-listview-item {
        margin-bottom: $gutter-size;
        border-width: 1px;
        border-style: solid;
        border-radius: $border-radius-default;
    }
}

// Hover style activated
.listview-hover.mx-listview {
    .mx-listview-item {
        &:hover,
        &:focus,
        &:active {
            background-color: $grid-bg-hover !important;
        }
        &.selected {
            &:hover,
            &:focus,
            &:active {
                background-color: $grid-bg-selected-hover !important;
            }
        }
    }
}

// Remove all styling
.listview-stylingless.mx-listview {
    .mx-listview-item {
        padding: 0;
        cursor: default;
        border: 0;
        background-color: transparent;
        &:hover,
        &:focus,
        &:active {
            background-color: transparent;
        }
        &.selected {
            background-color: transparent !important;
            &:hover,
            &:focus,
            &:active {
                background-color: transparent !important;
            }
        }
    }
}

// Templategrid Row Sizes
.listview-lg.mx-listview {
    .mx-listview-item {
        padding: ($grid-padding-top * 2) ($grid-padding-right * 2) ($grid-padding-bottom * 2) ($grid-padding-left * 2);
    }
}

.listview-sm.mx-listview {
    .mx-listview-item {
        padding: ($grid-padding-top / 2) ($grid-padding-right / 2) ($grid-padding-bottom / 2) ($grid-padding-left / 2);
    }
}

// Bootstrap columns
.mx-listview[class*="lv-col"] {
    overflow: hidden; // For if it is not in a layout, to prevent scrollbars
    .mx-listview-content-wrapper {
        display: block;
    }
    & > .mx-listview-list {
        display: block; // normal a table
        margin-right: -1 * $gutter-size;
        margin-left: -1 * $gutter-size;
        &::before,
        &::after {
            // clearfix
            display: table;
            clear: both;
            content: " ";
        }
        & > .mx-listview-item {
            // bootstrap col
            position: relative;
            display: block; // normal a table
            float: left;
            min-height: 1px;
            padding-right: $gutter-size;
            padding-left: $gutter-size;
            border: 0;
            @media (max-width: $screen-sm-max) {
                width: 100% !important;
            }
            & > .mx-dataview {
                overflow: hidden;
            }
        }
    }
    &.lv-col-xs-12 > .mx-listview-list > .mx-listview-item {
        width: 100% !important;
    }
    &.lv-col-xs-11 > .mx-listview-list > .mx-listview-item {
        width: 91.66666667% !important;
    }
    &.lv-col-xs-10 > .mx-listview-list > .mx-listview-item {
        width: 83.33333333% !important;
    }
    &.lv-col-xs-9 > .mx-listview-list > .mx-listview-item {
        width: 75% !important;
    }
    &.lv-col-xs-8 > .mx-listview-list > .mx-listview-item {
        width: 66.66666667% !important;
    }
    &.lv-col-xs-7 > .mx-listview-list > .mx-listview-item {
        width: 58.33333333% !important;
    }
    &.lv-col-xs-6 > .mx-listview-list > .mx-listview-item {
        width: 50% !important;
    }
    &.lv-col-xs-5 > .mx-listview-list > .mx-listview-item {
        width: 41.66666667% !important;
    }
    &.lv-col-xs-4 > .mx-listview-list > .mx-listview-item {
        width: 33.33333333% !important;
    }
    &.lv-col-xs-3 > .mx-listview-list > .mx-listview-item {
        width: 25% !important;
    }
    &.lv-col-xs-2 > .mx-listview-list > .mx-listview-item {
        width: 16.66666667% !important;
    }
    &.lv-col-xs-1 > .mx-listview-list > .mx-listview-item {
        width: 8.33333333% !important;
    }
    @media (min-width: $screen-sm) {
        &.lv-col-sm-12 > .mx-listview-list > .mx-listview-item {
            width: 100% !important;
        }
        &.lv-col-sm-11 > .mx-listview-list > .mx-listview-item {
            width: 91.66666667% !important;
        }
        &.lv-col-sm-10 > .mx-listview-list > .mx-listview-item {
            width: 83.33333333% !important;
        }
        &.lv-col-sm-9 > .mx-listview-list > .mx-listview-item {
            width: 75% !important;
        }
        &.lv-col-sm-8 > .mx-listview-list > .mx-listview-item {
            width: 66.66666667% !important;
        }
        &.lv-col-sm-7 > .mx-listview-list > .mx-listview-item {
            width: 58.33333333% !important;
        }
        &.lv-col-sm-6 > .mx-listview-list > .mx-listview-item {
            width: 50% !important;
        }
        &.lv-col-sm-5 > .mx-listview-list > .mx-listview-item {
            width: 41.66666667% !important;
        }
        &.lv-col-sm-4 > .mx-listview-list > .mx-listview-item {
            width: 33.33333333% !important;
        }
        &.lv-col-sm-3 > .mx-listview-list > .mx-listview-item {
            width: 25% !important;
        }
        &.lv-col-sm-2 > .mx-listview-list > .mx-listview-item {
            width: 16.66666667% !important;
        }
        &.lv-col-sm-1 > .mx-listview-list > .mx-listview-item {
            width: 8.33333333% !important;
        }
    }
    @media (min-width: $screen-md) {
        &.lv-col-md-12 > .mx-listview-list > .mx-listview-item {
            width: 100% !important;
        }
        &.lv-col-md-11 > .mx-listview-list > .mx-listview-item {
            width: 91.66666667% !important;
        }
        &.lv-col-md-10 > .mx-listview-list > .mx-listview-item {
            width: 83.33333333% !important;
        }
        &.lv-col-md-9 > .mx-listview-list > .mx-listview-item {
            width: 75% !important;
        }
        &.lv-col-md-8 > .mx-listview-list > .mx-listview-item {
            width: 66.66666667% !important;
        }
        &.lv-col-md-7 > .mx-listview-list > .mx-listview-item {
            width: 58.33333333% !important;
        }
        &.lv-col-md-6 > .mx-listview-list > .mx-listview-item {
            width: 50% !important;
        }
        &.lv-col-md-5 > .mx-listview-list > .mx-listview-item {
            width: 41.66666667% !important;
        }
        &.lv-col-md-4 > .mx-listview-list > .mx-listview-item {
            width: 33.33333333% !important;
        }
        &.lv-col-md-3 > .mx-listview-list > .mx-listview-item {
            width: 25% !important;
        }
        &.lv-col-md-2 > .mx-listview-list > .mx-listview-item {
            width: 16.66666667% !important;
        }
        &.lv-col-md-1 > .mx-listview-list > .mx-listview-item {
            width: 16.66666667% !important;
        }
    }
    @media (min-width: $screen-lg) {
        &.lv-col-lg-12 > .mx-listview-list > .mx-listview-item {
            width: 100% !important;
        }
        &.lv-col-lg-11 > .mx-listview-list > .mx-listview-item {
            width: 91.66666667% !important;
        }
        &.lv-col-lg-10 > .mx-listview-list > .mx-listview-item {
            width: 83.33333333% !important;
        }
        &.lv-col-lg-9 > .mx-listview-list > .mx-listview-item {
            width: 75% !important;
        }
        &.lv-col-lg-8 > .mx-listview-list > .mx-listview-item {
            width: 66.66666667% !important;
        }
        &.lv-col-lg-7 > .mx-listview-list > .mx-listview-item {
            width: 58.33333333% !important;
        }
        &.lv-col-lg-6 > .mx-listview-list > .mx-listview-item {
            width: 50% !important;
        }
        &.lv-col-lg-5 > .mx-listview-list > .mx-listview-item {
            width: 41.66666667% !important;
        }
        &.lv-col-lg-4 > .mx-listview-list > .mx-listview-item {
            width: 33.33333333% !important;
        }
        &.lv-col-lg-3 > .mx-listview-list > .mx-listview-item {
            width: 25% !important;
        }
        &.lv-col-lg-2 > .mx-listview-list > .mx-listview-item {
            width: 16.66666667% !important;
        }
        &.lv-col-lg-1 > .mx-listview-list > .mx-listview-item {
            width: 8.33333333% !important;
        }
    }
}

//== Phone specific 
//-------------------------------------------------------------------------------------------------------------------//
.profile-phone .mx-listview {
    .mx-listview-searchbar {
        margin-bottom: 3px;
        background: #FFFFFF;
        box-shadow: 0 1px 4px 0 rgba(0,0,0,0.14);
        input {
            padding: 14px 15px;
            color: #555555;
            border-style: none;
            border-radius: 0;
            box-shadow: none;
        }
    }
    .mx-listview-clear-button {
        padding: 14px 15px;
        color: inherit;
        border-style: none;
    }
    .mx-listview-item {
        &:first-child {
            border-top: none;
        }
    }
}
